package me.zhengjie.modules.biz.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

public class OrderSnCreate {

      /**
       * 生成订单编号
       * @return
       */
      public static String createOrderSn() {
            SimpleDateFormat dmDate = new SimpleDateFormat("yyyyMMddHHmmss");
            String randata = getRandom(6);
            Date date = new Date();
            String dateran = dmDate.format(date);
            String Xsode = "DD" + dateran + randata;
            if (Xsode.length() < 24) {
                  Xsode = Xsode + 0;
            }
            return Xsode;
      }

      public static String getRandom(int len) {
            Random r = new Random();
            StringBuilder rs = new StringBuilder();
            for (int i = 0; i < len; i++) {
                  rs.append(r.nextInt(10));
            }
            return rs.toString();
      }

      public static void main(String[] args) {
            System.out.println(createOrderSn());
      }

}
